<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: index.tpl 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
?>
<script language="javascript" type="text/javascript">
  var urlcarosel_sitealbum="<?php echo $this->url(array('action'=>'featured-photos-carousel'),"sitealbum_extended",true); ?>";
</script>
<?php
  $this->headLink()
     ->prependStylesheet($this->layout()->staticBaseUrl . 'application/modules/Sitealbum/externals/styles/sitealbum_featured_carousel.css');

	$this->headLink()
  ->appendStylesheet($this->layout()->staticBaseUrl
    . 'application/modules/Sitealbum/externals/styles/style_sitealbum.css');
     
  $this->headScript()
		->appendFile($this->layout()->staticBaseUrl . 'application/modules/Sitealbum/externals/scripts/slideitmoo-1.1_full_source.js');
?>

<a id="group_profile_members_anchor" style="position:absolute;"></a>
<script language="javascript" type="text/javascript">
 

  var forward_link;
  var fwdbck_click  = 1;
  var total = '<?php echo $this->totalCount; ?>';
  var limit='<?php echo $this->totalItemShow*2;?>';
  var curnt_limit=<?php echo $this->totalItemShow;?>;
  var slide_element_limit=1; 
  var no_of_row=<?php echo  $this->noOfRow?>;
  var in_one_row=<?php echo  $this->inOneRow?>;
  var startindex = -1;
  var call_count = 1;
</script>
<script language="javascript" type="text/javascript">
  var slideshow;
  window.addEvents ({
    'domready': function() {
      slideshow = new SitealbumSlideItMoo({
        overallContainer: 'Sitealbum_SlideItMoo_outer',
        elementScrolled: 'Sitealbum_SlideItMoo_inner',
        thumbsContainer: 'Sitealbum_SlideItMoo_items',
        slideVertical: <?php echo $this->vertical?>,
        itemsVisible:1,
        elemsSlide:1,
        duration:8000,
        itemsSelector: '.Sitealbum_SlideItMoo_element',
        itemWidth:<?php echo 146 * $this->inOneRow?>,
        itemHeight:<?php echo 146 * $this->noOfRow?>,
        showControls:1,
        startIndex:1,
        transition: Fx.Transitions.linear, /* transition */
        onChange: function(index) { call_count = 1;
        }
      });

      $('Sitealbum_SlideItMoo_back').addEvent('click', function () {slideshow.sendajax(-1,slideshow);
        call_count = 1;

      });

      $('Sitealbum_SlideItMoo_forward').addEvent('click', function () { slideshow.sendajax(1,slideshow);
        call_count = 1;
      });
     
      if((total -curnt_limit)<=0){
        // hidding forward button
       document.getElementById('Sitealbum_SlideItMoo_forward').style.display= 'none';
       document.getElementById('Sitealbum_SlideItMoo_back_disable').style.display= 'none';
      }
    }
  });
  var obj_sliditmoo;
  function custom_sliditmoo (obj, direction) {


    obj_sliditmoo = new SitealbumSlideItMoo({
      overallContainer: 'Sitealbum_SlideItMoo_outer',
      elementScrolled: 'Sitealbum_SlideItMoo_inner',
      thumbsContainer: 'Sitealbum_SlideItMoo_items',
      slideVertical: <?php echo $this->vertical?>,
      itemsVisible:1,
      elemsSlide:1,
      duration:<?php echo  $this->interval;?>,
      itemsSelector: '.Sitealbum_SlideItMoo_element',
      itemWidth:<?php echo 146 * $this->inOneRow?>,
      itemHeight:<?php echo 146 * $this->noOfRow?>,
      showControls:1,
      startIndex:1,
      onChange: function(index) { call_count = 1;
      }
    });

    obj_sliditmoo.slide(direction, obj_sliditmoo);
    var start_Index_D=parseInt(curnt_limit) * parseInt(startindex);
    if(start_Index_D<=0 && direction== -1){
         // hidding back button
         document.getElementById('Sitealbum_SlideItMoo_back').style.display= 'none';
         document.getElementById('Sitealbum_SlideItMoo_back_disable').style.display= 'block';
      }else{
        // vissible back button
        document.getElementById('Sitealbum_SlideItMoo_back').style.display= 'block';
        document.getElementById('Sitealbum_SlideItMoo_back_disable').style.display= 'none';

      }

        if(((start_Index_D>(total-limit)|| (start_Index_D>=(total-limit))) && direction== 1) || ((start_Index_D>=(total-curnt_limit)) && direction==  -1)){
         // hidding forward button
          document.getElementById('Sitealbum_SlideItMoo_forward').style.display= 'none';
          document.getElementById('Sitealbum_SlideItMoo_forward_disable').style.display= 'block';

      }else{
         // vissible forward button
           document.getElementById('Sitealbum_SlideItMoo_forward').style.display= 'block';
           document.getElementById('Sitealbum_SlideItMoo_forward_disable').style.display= 'none';
      }
     fwdbck_click = 1;
  }
</script>
<?php
$photoSettings=  array();
$photoSettings['class'] = 'thumb';
if($this->showLightBox):
include_once APPLICATION_PATH . '/application/modules/Sitealbum/views/scripts/_lightboxPhoto.tpl';
endif;
?>
<ul class="sitealbum_featured_album_slider">
  <li>
		<?php
    $extra_width=0;
    $extra_height=0;    
        if (empty($this->vertical)):
        $typeClass='horizontal';
         if ($this->totalCount > $this->totalItemShow):
          $extra_width = 60;
          endif;
          $prev='back';
          $next='forward';
        else:
        	$typeClass='vertical';
        if ($this->totalCount > $this->totalItemShow):
          $extra_height=50;
          endif;
          $prev='up';
          $next='down';
        endif;
     ?>
    <div id="Sitealbum_SlideItMoo_outer" class="Sitealbum_SlideItMoo_outer_<?php echo $typeClass;?>" style="height:<?php echo 146*$this->heightRow+$extra_height;?>px; width:<?php echo (146*$this->inOneRow)+$extra_width;?>px;">
      <div class="Sitealbum_SlideItMoo_back" id="Sitealbum_SlideItMoo_back" style="display:none;">
				<?php echo $this->htmlImage($this->layout()->staticBaseUrl . "application/modules/Sitealbum/externals/images/slider-$prev.png", '', array('align'=>'', 'onMouseOver'=>'this.src="'. $this->layout()->staticBaseUrl . 'application/modules/Sitealbum/externals/images/slider-'.$prev.'-active.png";','onMouseOut'=>'this.src="'. $this->layout()->staticBaseUrl . 'application/modules/Sitealbum/externals/images/slider-'.$prev.'.png";', 'border'=>'0')) ?>
      </div>
      <div class="Sitealbum_SlideItMoo_back" id="Sitealbum_SlideItMoo_back_loding" style="display:none;">
        <?php echo $this->htmlImage($this->layout()->staticBaseUrl . "application/modules/Core/externals/images/loading.gif", '', array('align'=>'', 'border'=>'0','class'=>'Sitealbum_SlideItMoo_loding'));  ?>
      </div>      
       <div class="Sitealbum_SlideItMoo_back_disable" id="Sitealbum_SlideItMoo_back_disable" style="display:block;cursor:default;">
				<?php echo $this->htmlImage($this->layout()->staticBaseUrl . "application/modules/Sitealbum/externals/images/slider-$prev-disable.png", '', array('align'=>'', 'border'=>'0'));  ?>
      </div>
      <div id="Sitealbum_SlideItMoo_inner">
        <div id="Sitealbum_SlideItMoo_items" style="height:<?php echo 146*$this->heightRow;?>px;">
          <div class="Sitealbum_SlideItMoo_element" style="width:<?php echo 146*$this->inOneRow;?>px;">
              <div class="Sitealbum_SlideItMoo_PhotoList">
               <?php  $i=0; ?>
                  <?php foreach ($this->featuredPhotos as $photo):?>
                       <div class="featured_thumb_photo">
                          <a href="<?php echo $photo->getHref() ?>"  <?php if ($this->showLightBox): ?> onclick='openLightBoxAlbum("<?php echo $photo->getPhotoUrl() ?>","<?php echo Engine_Api::_()->sitealbum()->getLightBoxPhotoHref($photo,array_merge($this->params, array('offset'=>$i))) ?>");return false;' <?php endif; ?> title="<?php echo $photo->title; ?>" class="thumb_img">
                          	<span style="background-image: url(<?php echo $photo->getPhotoUrl('thumb.normal'); ?>);"></span>
                          </a>
                          <span class="show_photo_des">
                            <?php
                            $owner = $photo->getOwner();
                            $parent = $photo->getParent();
                            echo $this->translate('By %1$s in %2$s',
                                 $this->htmlLink($owner->getHref(), $this->string()->truncate($owner->getTitle(),25)),
                                 $this->htmlLink($parent->getHref(), $this->string()->truncate($parent->getTitle(),25)));
                            ?>
                          </span>
                      </div>
                   <?php  $i++; ?>
                  <?php endforeach; ?>
                <?php for($i; $i<($this->heightRow *$this->inOneRow);$i++):?>
                <div class="featured_thumb_photo"></div>
                <?php endfor; ?>
              </div>
           </div>
        </div>
      </div>
      <div class="Sitealbum_SlideItMoo_forward" id ="Sitealbum_SlideItMoo_forward">
      	<?php echo $this->htmlImage($this->layout()->staticBaseUrl . "application/modules/Sitealbum/externals/images/slider-$next.png", '', array('align'=>'', 'onMouseOver'=>'this.src="' . $this->layout()->staticBaseUrl . 'application/modules/Sitealbum/externals/images/slider-'.$next.'-active.png";','onMouseOut'=>'this.src="'. $this->layout()->staticBaseUrl . 'application/modules/Sitealbum/externals/images/slider-'.$next.'.png";', 'border'=>'0')) ?>
      </div>
      <div class="Sitealbum_SlideItMoo_forward" id="Sitealbum_SlideItMoo_forward_loding"  style="display: none;">
        <?php echo $this->htmlImage($this->layout()->staticBaseUrl . "application/modules/Core/externals/images/loading.gif", '', array('align'=>'', 'border'=>'0','class'=>'Sitealbum_SlideItMoo_loding'));  ?>
      </div>
      <div class="Sitealbum_SlideItMoo_forward_disable" id="Sitealbum_SlideItMoo_forward_disable" style="display:none;cursor:default;">
      	<?php  echo $this->htmlImage($this->layout()->staticBaseUrl . "application/modules/Sitealbum/externals/images/slider-$next-disable.png", '', array('align'=>'', 'border'=>'0'));  ?>
      </div>
    </div>
    <div class="clear"></div>
  </li>
</ul>
